package com.my.config;

import com.my.interceptor.Sessioninterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by Zhang on 2018/8/26.
 */
@Configuration
public class SessionConfig extends WebMvcConfigurerAdapter {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //配置 不需要拦截的包和请求
   String[]excludePathPatterns=new String[]{"/user/main","/user/login","/assets/**","/css/**","/font/**","/img/**","/js/**","/websocket/**"};
        registry.addInterceptor(new Sessioninterceptor()).addPathPatterns("/**").excludePathPatterns(excludePathPatterns);
    }


}
